﻿Imports System.Net
Imports System.Windows
'Imports Microsoft.Extensions.DependencyInjection

Partial Public Class App
    Inherits Application

    'Private Shared _serviceProvider As IServiceProvider
    'Private Shared ReadOnly Property ServiceProvider As IServiceProvider
    '    Get
    '        Return _serviceProvider
    '    End Get
    'End Property

    'Public Shared Function GetServiceProvider() As IServiceProvider
    '    Return ServiceProvider
    'End Function

    Public Sub New()
        Me.InitializeComponent()

        '    ' 创建服务容器并注册服务
        '    Dim services = New ServiceCollection()
        '    ConfigureServices(services)
        '    _serviceProvider = services.BuildServiceProvider()

        ' 使用服务容器创建 MainPage 实例
        'System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12

        Dim mainPage = New RootLayout()
        Window.Current.Content = mainPage
    End Sub

    'Private Sub ConfigureServices(services As IServiceCollection)
    '    ' 这里注册页面和 ViewModel
    '    services.AddSingleton(Of RootLayout)()
    '    services.AddSingleton(Of RootLayoutViewModel)()
    '    ' 其他服务注册...
    '    services.AddTransient(Of HttpClientBase)()
    '    'services.AddTransient(Of ApiException)()
    '    services.AddTransient(Of INavigationService, NavigationService)()
    'End Sub
End Class
